<template>
  <div class="tabbar">
    <van-tabbar v-model="active">
      <van-tabbar-item to="/index">
        <span>首页</span>
        <template #icon="props">
          <img :src="props.active ? homeIcon.active : homeIcon.inactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/course">
        <span>课程</span>
        <template #icon="props">
          <img :src="props.active ? courseIcon.active : courseIcon.inactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/record">
        <span>约课记录</span>
        <template #icon="props">
          <img :src="props.active ? homeIcon.active : homeIcon.inactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/practice">
        <span>练习</span>
        <template #icon="props">
          <img :src="props.active ? courseIcon.active : courseIcon.inactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/login">
        <span>我的</span>
        <template #icon="props">
          <img :src="props.active ? homeIcon.active : homeIcon.inactive" />
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
import {reactive,toRefs} from 'vue'
export default {
    setup(props) {
        const data=reactive({
          token:localStorage.getItem('msmktoken'),
            active:0,
            homeIcon:{
                active:require('../assets/theme-img/home-active.png'),
                inactive:require('../assets/theme-img/home.png')
            },
            courseIcon:{
                active:require('../assets/theme-img/course-active.png'),
                inactive:require('../assets/theme-img/course.png')
            },
        })
        return{...toRefs(data)}
    }
}
</script>